﻿using Xtensive.Orm;

namespace IndexWithIncludedFields.Model
{
    /*
     * To declare index with additional (non-key) fields, list them in Index.IncludedFields property as array of field names.
     * Also you can set the desired index name, this is optional
     * More on that kind of indexes: http://technet.microsoft.com/en-us/library/ms190806.aspx
     */
    [HierarchyRoot]
    [Index("Username", IncludedFields = new [] {"FirstName", "LastName"}, Name = "IX_USERNAME")]
    public class Person : Entity
    {
        [Field, Key]
        public int Id { get; private set; }

        [Field]
        public string Username { get; set; }

        [Field]
        public string FirstName { get; set; }

        [Field]
        public string LastName { get; set; }

        public Person(Session session) :
            base(session)
        {}
    }
}